import { http } from "@/utils/http";
import { baseUrlApi, filerEmptyVal } from "../utils";

/** 订单列表查询 */
export const getStoreOrderList = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/storeOrder/page"), {
    params: filerEmptyVal(params)
  });
};

/** 数量统计 */
export const getStoreOrderSum = (params?: object) => {
  return http.request<any>(
    "get",
    baseUrlApi("/storeOrder/state/quantity/statistics"),
    {
      params: filerEmptyVal(params)
    }
  );
};

/** 新增订单 */
export const addStoreOrder = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/storeOrder/add"), {
    data: filerEmptyVal(data)
  });
};

/** 订单详情 */
export const getStoreOrderDetail = (params?: object) => {
  return http.request<any>("get", baseUrlApi("/storeOrder/detail"), { params });
};

/** 修改订单 */
export const upStoreOrder = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/storeOrder/update"), { data });
};

/** 审核操作(通过/驳回/取消订单) */
export const upStoreOrderStatus = (data?: object) => {
  return http.request<any>("post", baseUrlApi("/storeOrder/storeOrderAudit"), {
    data
  });
};
